const appendData = function (list) {}
export default function getBizSubTree(list, rootId, { idName = 'id', parentIdName = 'parentId', childName = 'children' } = {}) {
  const objMap = {}
  const result = []
   for (const item of list) {
    const id = item[idName]
    const parentId = item[parentIdName]
    objMap[id] = !objMap[id] ? item : { ...item, ...objMap[id] }
    const treeItem = objMap[id]
    if (parentId == rootId) {
      result.push(treeItem)
    } else {
      if (!objMap[parentId]) {
        objMap[parentId] = {}
      }
      if (!objMap[parentId][childName]) {
        objMap[parentId][childName] = []
      }
      objMap[parentId][childName].push(treeItem)
    }
   }
  return result
}